package com.ruoyi.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.Statemp3;
import com.ruoyi.system.service.IStatemp3Service;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 静态音频mp3文件Controller
 * 
 * @author ç¹è½æ²
 * @date 2025-05-06
 */
@RestController
@RequestMapping("/system/statemp3")
public class Statemp3Controller extends BaseController
{
    @Autowired
    private IStatemp3Service statemp3Service;

    /**
     * 查询静态音频mp3文件列表
     */
    @PreAuthorize("@ss.hasPermi('system:statemp3:list')")
    @GetMapping("/list")
    public TableDataInfo list(Statemp3 statemp3)
    {
        startPage();
        List<Statemp3> list = statemp3Service.selectStatemp3List(statemp3);
        return getDataTable(list);
    }

    /**
     * 导出静态音频mp3文件列表
     */
    @PreAuthorize("@ss.hasPermi('system:statemp3:export')")
    @Log(title = "静态音频mp3文件", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Statemp3 statemp3)
    {
        List<Statemp3> list = statemp3Service.selectStatemp3List(statemp3);
        ExcelUtil<Statemp3> util = new ExcelUtil<Statemp3>(Statemp3.class);
        util.exportExcel(response, list, "静态音频mp3文件数据");
    }

    /**
     * 获取静态音频mp3文件详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:statemp3:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(statemp3Service.selectStatemp3ById(id));
    }

    /**
     * 新增静态音频mp3文件
     */
    @PreAuthorize("@ss.hasPermi('system:statemp3:add')")
    @Log(title = "静态音频mp3文件", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Statemp3 statemp3)
    {
        return toAjax(statemp3Service.insertStatemp3(statemp3));
    }

    /**
     * 修改静态音频mp3文件
     */
    @PreAuthorize("@ss.hasPermi('system:statemp3:edit')")
    @Log(title = "静态音频mp3文件", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Statemp3 statemp3)
    {
        return toAjax(statemp3Service.updateStatemp3(statemp3));
    }

    /**
     * 删除静态音频mp3文件
     */
    @PreAuthorize("@ss.hasPermi('system:statemp3:remove')")
    @Log(title = "静态音频mp3文件", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(statemp3Service.deleteStatemp3ByIds(ids));
    }
}
